'\" te
.\"  Copyright (c) 2005 by Sun Microsystems, Inc. All rights reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH MOE 1 "Feb 2, 2005"
.SH NAME
moe \- manifest the optimal expansion of a pathname
.SH SYNOPSIS
.LP
.nf
\fBmoe\fR [\fB-c\fR] [\fB-32\fR | \fB-64\fR] [\fB-s\fR | \fB-v\fR] \fIpath\fR
.fi

.SH DESCRIPTION
.sp
.LP
The \fBmoe\fR utility manifests the optimal expansion of a pathname containing
reserved runtime linker tokens. These tokens can be used to define
dependencies, filtees and runpaths within dynamic objects. The expansion of
these tokens at runtime, provides a flexible mechanism for selecting objects
and search paths that perform best on this machine. See \fBld.so.1\fR(1).
.sp
.LP
For example, the token \fB$HWCAP\fR can be employed to represent filters and
dependencies. The runtime interpretation of this token can result in a family
of objects that are analyzed to determine their applicability for loading with
a process. The objects are sorted based on the hardware capabilities that each
object requires to execute. \fBmoe\fR returns the name of the object optimally
suited for execution on the current platform.
.sp
.LP
\fBmoe\fR analyzes a pathname by passing the supplied \fIpath\fR to
\fBdlmopen\fR(3C), together with the \fBRTLD_FIRST\fR flag. Reserved token
expansion is therefore carried out by \fBld.so.1\fR as the expansion would
occur in an executing process. Although multiple objects can be analyzed as a
result of the \fBdlmopen()\fR call, the \fBRTLD_FIRST\fR flag insures only the
optimal object is processed.
.sp
.LP
By default, \fBmoe\fR analyzes the specified \fIpath\fR twice. The first
analysis looks for 32-bit objects. The second analysis, if applicable, looks
for 64-bit objects. Typically, 32-bit objects and 64-bit objects are isolated
to different directories. These directories are frequently named to reflect the
class of object the directory contains. The multiple passes of \fBmoe\fR catch
any instances where 32-bit objects and 64-bit objects occupy the same
directory. Multiple passes also provide flexibility when the pathname that is
specified does not convey to the user the class of object the directory might
contain.
.sp
.LP
For a complete description of the reserved token expansion carried out by the
runtime linker, refer to the \fILinker and Libraries Guide\fR.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-32\fR\fR
.ad
.RS 7n
Only analyze 32-bit objects.
.RE

.sp
.ne 2
.na
\fB\fB-64\fR\fR
.ad
.RS 7n
Only analyze 64-bit objects.
.RE

.sp
.ne 2
.na
\fB\fB-c\fR\fR
.ad
.RS 7n
Prefix each pathname with the class of the object.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR\fR
.ad
.RS 7n
Silent. No optimal name, or error diagnostics are displayed. Only an error
return is made available. This option is only meaningful with the \fB-32\fR and
\fB-64\fR options. The \fB-s\fR option can not be used with the \fB-v\fR
option.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 7n
Verbose. If no optimal expansion name can be determined, an error diagnostic is
written to standard error. The \fB-v\fR option can not be used with the
\fB-s\fR option.
.RE

.SH OPERANDS
.sp
.LP
The following operand is supported:
.sp
.ne 2
.na
\fB\fIpath\fR\fR
.ad
.RS 8n
The pathname to be expanded.
.RE

.SH EXAMPLES
.sp
.LP
The following example uses \fBmoe\fR to display the optimal expansion of
objects in the directory \fB/usr/lib/libc\fR. This directory contains a family
of Intel objects that are built to use various hardware capabilities.
.sp
.in +2
.nf
% \fBmoe '/usr/lib/libc/$HWCAP'\fR
/usr/lib/libc/libc_hwcap.so.1
.fi
.in -2
.sp

.sp
.LP
The \fB-c\fR option can be used to clarify the class of the optimal object.
.sp
.in +2
.nf
% \fBmoe -c '/usr/lib/libc/$HWCAP'\fR
32-bit: /usr/lib/libc/libc_hwcap.so.1
.fi
.in -2
.sp

.sp
.LP
The following example uses \fBmoe\fR to display the optimal expansion of
objects under the \fB/opt/ISV/cpu\fR directory hierarchy. These directories
contain a family of SPARC objects that are built for various platforms.
.sp
.in +2
.nf
% \fBmoe -c -64 '/opt/ISV/$ISALIST/isa.so.1'\fR
64-bit: /opt/ISV/sparcv9/isa.so.1
.fi
.in -2
.sp

.sp
.LP
The \fB-v\fR can be used to diagnose the instance where an optimal name is not
returned. An attempt to inspect the previous pathname as a 32-bit object, would
result in the following diagnostic being produced.
.sp
.in +2
.nf
% \fBmoe -c -v -32 '/opt/ISV/$ISALIST/isa.so.1'\fR
32-bit: /opt/ISV/sparcv9/isa.so.1: wrong ELF class: ELFCLASS64
.fi
.in -2
.sp

.SH EXIT STATUS
.sp
.LP
When the \fB-32\fR or \fB-64\fR options are in effect, a successful optimal
expansion returns \fB0\fR, otherwise non-zero. Without the \fB-32\fR or
\fB-64\fR options in effect, the return value is always \fB0\fR.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Stable
.TE

.SH SEE ALSO
.sp
.LP
.BR isalist (1),
.BR ld.so.1 (1),
.BR optisa (1),
.BR dlmopen (3C),
.BR attributes (7)
.sp
.LP
\fILinker and Libraries Guide\fR
